package com.wangxiang.shop.member.controller;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


import com.wangxiang.shop.member.entity.DevReceiptEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wangxiang.shop.member.entity.LocaltionEntity;
import com.wangxiang.shop.member.service.LocaltionService;
import com.wangxiang.common.utils.PageUtils;
import com.wangxiang.common.utils.R;



/**
 * 
 *
 * @author wangxiang
 * @email 2293672863@qq.com
 * @date 2022-04-10 22:21:36
 */
@RestController
@RequestMapping("member/localtion")
public class LocaltionController {
    @Autowired
    private LocaltionService localtionService;

    /**
     * 获取所有省，不需要参数
     * @return
     */
    @RequestMapping("province")
    public R province(){
        List<DevReceiptEntity> province = localtionService.province();
        return R.ok().put("list",province);
    }


    @RequestMapping("city")
    public R city(@RequestBody HashMap<String , String> map){
        if (map==null){
            return R.error("程序异常");
        }
        List<DevReceiptEntity> value = localtionService.city(map.get("value"));
        return R.ok().put("list",value);
    }

    @RequestMapping("area")
    public R area(@RequestBody HashMap<String , String> map){
        if (map==null){
            return R.error("程序异常");
        }
        List<DevReceiptEntity> value = localtionService.area(map.get("value"));
        return R.ok().put("list",value);
    }




}
